<?php

 
namespace RedMVC\Form\Element;
use RedMVC;

/**
 * Select class
 *  
 * @category    RedMVC
 * @package     Form
 * @subpackage  Element 
 * @author      Jan Fischer, bitWorking <info@bitworking.de>
 */
class Select extends AElementMulti{    
    public function render(){
        $translate = RedMVC\Registry::get('RedMVC_Translate');
        $out = '<select name="'.$this->varname.'"'.$this->form->buildAttributes($this->attributes).'>';         
        foreach($this->getOptions() as $value=>$name){
            $selected = ($this->getValue() == $value) ? ' selected="selected"' : '';
            $out .= '  <option value="'.$value.'"'.$selected.'>'.$translate->_($name).'</option>';
    	}
    	$out .= '</select>';
    	return $out;
    }
}